<?php 
if($_POST['submit']!=''){
    for($i=0;$i<count($_POST['selectbox']);$i++)
    {
        $query = "delete from ".DBPREFIX."exam_thread where thread_id=".$_POST['selectbox'][$i];
        $result = $db->query($query);
    }
    if($result){
        fs_showmsg('删除成功!','?do=addthreadquestion&examid='.$_POST['exam_id']);
    }
    else{
        fs_showmsg('删除失败!');
    }
}
?>
<script type="text/javascript">
    function colsechoose(){
        $("#question_box").css({display:"none"});
        $("#question_list").html('');//清空问题列表
        $("#fromdb").attr("value","0");//清空所选的库
        $("#kownledge").attr('value','');//清空input框里面的值
        
    }   
</script>
<div class="question_select_box" id="question_box">
     <form action="?do=insertquestion" method="post" onsubmit="return checkBoxSelect()">
        <div class="select_tijian">
           
                <h1>问题筛选<input type="button" class="close" onclick="colsechoose()"/></h1>
                <span>所属题库:<select name="fromdb" id="fromdb">
                        <option value="0">请选择题库..</option>
                        <?php    
                        $query="select * from ".DBPREFIX."tiku where t_createuid=".$teacher_id;
                        //echo $query;exit();
                        $result=$db->query($query);
                        while($row =$db->fetch_array($result)){?>
                        <option value="<?php echo $row['t_id'];?>"><?php echo $row['t_name'];?></option>
                        <?php 
                        }
                        ?>
                        </select></span>
                <!--<span>试题类型:<select name="question"><option value="0">请选择试题类型</option></select></span>-->
                <span>知识点:<input type="text" id="kownledge" name="kownledge"></span>
                <span id="threaddiv" sytle="display:none;"></span><!--点击不同的类型 传递不同的类型值-->
                <span id="threaddiv2" style="display:none"></span><!--传递threadid-->
                <span><input type="button" value="筛选" class="shaixuan" onclick="shaixuan()" /></span>
            
        </div>
        <div class="select_question_list" id="insert_input">
                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="question_list" id="tblist1">
                        <tr><td colspan="2" class="button">&nbsp;&nbsp;&nbsp;<input type="button"  value="全选" id="allselect1" />&nbsp;&nbsp;&nbsp;<input type="button" id="elseselect1"  value="反选"/></td></tr>
                <tr>
                    <td colspan="2">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="question_list" id="question_list">
                    
                        </table>
                    </td>
                </tr>
                <tr><td colspan="2"  class="center"><input type="submit" name="submit" value="提交"/></td></tr>
                </table>
        </div>
    </form>
</div>
<form action="?do=addthreadquestion" method="post" onsubmit="return checkBoxSelect()">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="CContent">
  <tr><td>
    <div class="submenu_t">
            <ul>
                <li><a href="?do=elist">试卷列表</a> | </li>
                <li><a href="?do=add_e">编写试卷</a> | </li>
            </ul>
    </div>
    </td>
    </tr>
    <tr><td>
                    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="question_list" id="tblist">
                            <thead>
                                    <tr>
                                            <th></th>
                                        <th>题型名称</th>
                                        <th>说明</th>
                                        <th>排序</th>
                                        <th>题目数</th>
                                        <th>所属试卷</th>
                                        <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                    
                                            <?php
                                            $query = "select a.*,b.* from ".DBPREFIX."exam_thread as a inner join ".DBPREFIX."exam as b on a.exam_id=b.exam_id where a.exam_id=".$_GET['examid'];
                                            $result = $db->query($query);
                                            while($row = $db->fetch_array($result))
                                            {
                                            ?>
                                            <tr>
                                                    <td><input type="checkbox" name="selectbox[]"  value="<?php echo $row['thread_id']?>" /><input type="hidden" name="exam_id" value="<?php echo $_GET['examid']?>"/></td>
                                                    <td><?php switch($row['thread_type']){ case 1: echo '单选题';break;case 2:echo '多选题'; break;case 3: echo '判断题';break;default: echo '';}?></td>
                                                    <td><?php echo $row['thread_des']?></td>
                                                    <td><?php echo $row['thread_sort']  ?></td>
                                                    <td><?php echo $row['thread_question_num']  ?></td>
                                                    <td><?php echo $row['exam_name'];?></td>
                                                    <td><input type="button" value="添加试题" class="add_bg_g" onclick="goAddQuestion(threadid=<?php echo $row['thread_id']?>,<?php echo $row['thread_type']?>)" />&nbsp;&nbsp;&nbsp;<input type="button" onclick="window.location.href='?do=edit_e&threadid=<?php echo $row['thread_id'];?>'" value="编辑" class="add_bg_g" /></td>
                                            </tr>
                                            <?php
                                            }
                                            ?>
                                            
                                    
                            </tbody>
                    </table>
            </td></tr>
    <tr><td>
    <div class="submenu_b">
            <ul>
               <li><input type="button" name="selectall" id="allselect" value="全选"/></li>
		<li><input type="button" name="noneselect" id="noneselect" value="全不选"/></li>
        <li><input type="button" name="nonesselect" id="elseselect" value="反选"/></li>
		<li><input type="submit" name="submit" value="删除"/></li>
            </ul>
    </div>
    </td>
    </tr>
</table>
</form>